@import 'app_standalone.less';

@accent-color: #900000; // #A01020; // #ff9800;
@background-color: #eeeeee;
// @link-color: #ff9800;
// @link-color: #ff5722; // #ea1c0d;
@link-color: #ff5722; // #ea1c0d;

@font-family: "Noto Sans", "Helvetica Neue", Helvetica, Arial, "Nimbus Sans L", "Liberation Sans", Arimo, sans-serif;
@standard-border-radius: 2px;
@info-border-radius: @standard-border-radius;
@button-border-radius: 20px;
@large-balloon-border-radius: 2px; 

@object-background-color: #DDDDDD;
// @mosaico-object-shadow: 1px 1px 2px lighten(@shadow-color, 30%);

@input-background-color: white;
@input-border-color: lighten(@text-color, 20%);

@mosaico-selection-color: @link-color;

#main-preview #preview-toolbar {
  padding: 1px 5px;
}

#toolbar {
  padding: 1px 5px;
}

@button-background-color: @link-color;
@button-border-color: transparent;

@ui-tabs-panel-padding: 0;

@slider-track-height: 4px;
@slider-thumb-height: 14px;

.button-style() {
  text-transform: uppercase;
}

.button-style-focus() {
  background-color: lighten(@button-background-color, 10%);
  box-shadow: none;
}

#main-edit-area .tool {
  border-radius: 100%;
  padding: 4px;
  padding-bottom: 2px;
  box-shadow: 1px 1px 3px @shadow-color;
}

#toolbar, #preview-toolbar {
  .ui-buttonset {
    &:focus-within {
      background-color: @mosaico-ui-background-color;
      box-shadow: none;
    }
  }
  .ui-button {
    border-radius: 0;
    padding-top: 7px;
    padding-bottom: 7px;
    line-height: 22px;

    background-color: @mosaico-ui-background-color;
    &:hover, &.pressed, &:focus, &.ui-state-focus {
      background-color: lighten(@mosaico-ui-background-color, 10%);
      box-shadow: none;
    }
    &.selected, &.ui-state-active {
      border-bottom: 2px solid @button-text-color;
      border-top: 0;
    }
    &.ui-button-disabled, &.ui-button-disabled .ui-icon, &.ui-button-disabled .ui-button-text {
      color: mix(@mosaico-ui-background-color, @button-text-color);
    }
  }
} 

#main-toolbox #toolimages .ui-tabs > .ui-tabs-nav > li > a {
  border-radius: 0;
}

#main-toolbox #tooltabs.ui-tabs > .ui-tabs-nav {
  box-shadow: 0 0 10px @shadow-color;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 105; // the panel is 100, and the main toolbar 110
}

#main-toolbox #tooltabs.ui-tabs {
  .ui-tabs-nav {
    font-size: 1em;
    li {
      margin: 1px 1px 0 0;
      line-height: @topbar-height - 4px;

      &.ui-state-focus {
        background-color: lighten(@mosaico-ui-background-color, 10%);
        box-shadow: none;
      }

      a {
        border-radius: 0;
      }
    }
  }
}

.addblockbutton {
  box-shadow: 1px 1px 3px @shadow-color;
}

.tabs-style(@activeclass: ~'.active', @buttonstyle: false, @focusclass: ~'.focus') {

  text-transform: uppercase;

  & when (@buttonstyle) {
    border-bottom: 0;
    background-color: transparent;
  }
  li > a when (@buttonstyle) {
    background-color: transparent; 
    border-radius: 0;
    &:hover {
      background-color: lighten(@mosaico-ui-background-color, 10%);
      border-bottom: 3px solid lighten(@mosaico-ui-background-color, 10%);
    } 
  }

  li@{focusclass} when (@buttonstyle) {
    .button-style-focus();
  }
  li@{focusclass} when not (@buttonstyle) {
    .input-style-focus();
  }

  li@{activeclass} a {
    & when(@buttonstyle) {
      background-color: transparent;
      color: @button-text-color;
      border-bottom: 3px solid @button-text-color;
    } 
  }


}

#main-toolbox {
  .blockCheck input[type=checkbox] {
    &:checked + .checkbox-replacer:after,
    & + .checkbox-replacer:before {
      border-radius: 50%;
      // padding: 5px;
      box-shadow: 1px 1px 2px @shadow-color;
    }

    & + .checkbox-replacer:after,
    &:checked + .checkbox-replacer:before {
      border-radius: 30px;
      background-color: lighten(@button-background-color, 20%);
      color: @button-text-color;
      // margin: 0 -2px;
    }
    & + .checkbox-replacer:after {
      padding-left: 15px;
      margin-left: -15px;
      border-color: transparent;
    }
    &:checked + .checkbox-replacer:before {
      padding-right: 15px;
      margin-right: -15px;
      border-color: transparent;
    }
  }


  .objEdit .propInput input[type=checkbox] {
    &:focus + .checkbox-replacer:after {
      .input-style-focus;
    }
  
    &:checked + .checkbox-replacer:before {
      margin-left: 20px;
      background-color: @button-background-color;
    }
    & + .checkbox-replacer:after,
    & + .checkbox-replacer:before {
      content: " ";
      display: block;
      transition: margin-left .2s, background-color .2s;
    }
    & + .checkbox-replacer:before {
      width: 20px;
      height: 20px;
      background-color: white;
      border-radius: 50%;
      font-size: 120%;
      box-shadow: 1px 1px 3px @shadow-color;
    }
    &:checked + .checkbox-replacer:after {
      background-color: lighten(@button-background-color, 20%);
    }
    & + .checkbox-replacer:after {
      width: 34px;
      height: 14px;
      margin: -16px 2px 0 2px;
      border-radius: 7px;
      background-color: lighten(@text-color, 30%);
    }
  }

}
.mo .objEdit input[type=checkbox]+.checkbox-replacer:before {
  color: @button-background-color;
}

.mo .propInput .mo-select select {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.mo .propInput .mo-select:after,
.mo .propInput .data-select .selectize-control.single .selectize-input:after {
  background-color: transparent !important;
  color: lighten(@text-color, 30%);
}
.mo .propInput .evo-pointer:before {
  background-color: white;
  color: lighten(@text-color, 30%);
}
.mo .propInput .data-integer .ui-spinner-button .ui-button-text {
  background-color: transparent;
  color: lighten(@text-color, 30%);
}
.mo .propInput .mo-select:hover:after,
.mo .propInput .data-select .selectize-control.single .selectize-input:hover:after,
.mo .propInput .evo-pointer:hover:before,
.mo .ui-button.ui-spinner-button.ui-state-hover,
.mo .propInput .data-integer .ui-button-text,
.mo .propInput .data-integer .ui-spinner-button:hover .ui-button-text {
  color: @button-background-color;
}

.mo .propInput .ui-spinner .ui-spinner-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.mo .ui-button.ui-spinner-button {
  background-color: transparent;
  // color: lighten(@text-color, 30%); 
  .ui-button-text .ui-icon {
    color: lighten(@text-color, 30%); 
  }
}

#main-toolbox .objLabel.level1 {
  font-weight: bold;
  border-bottom-width: 1px;
}

.mo .objPreview {
  border-width: 0;
  box-shadow: 1px 1px 3px @shadow-color;
}

.mo .objLabel {
  border-bottom: 0;
  font-weight: bold;
  font-size: 80%;
}

.mo .objEdit.level1 {
  border-top: 2px solid @accent-color;
}

#main-toolbox .objLabel.level1 {
  font-size: 1em;
  padding-top: .5em;
}

.mo #toolstyles .objLabel.level1, .mo #tooltheme .objLabel.level1 {
  padding-left: 70px;
}

.mo .objLabel.level0 {
  border-bottom: none;
}

.input-style() {
  box-shadow: none;
}

.mo {
  a {
    &:link, &:visited {
      color: white;
    }
  }
}
#main-toolbox {
  .noSelectedBlock, .customStyleHelp, .objEmpty, .galleryEmpty {
    font-size: 1em;
  }
  .noSelectedBlock, .customStyleHelp, .objEmpty {
    margin-left: -15px;
    padding-left: 25px;
    padding-right: 25px;
    width: ~"calc(100% + 40px)";
  }
}



& when(true) {
  .mo .objEdit.level1 {
      background-color: white;
      box-shadow: 1px 1px 3px #888;
      border-top: 0;
      padding: 6px;
      padding-top: .5em;
  }

  .mo #toolstyles, .mo #tooltheme {
    .objEdit.level1 {
      border-top-left-radius: 30px;
      .objLabel.level1 {
        padding-bottom: 0;
        padding-top: 1em;
      }
    }
  }

  .mo .objPreview {
      border-width: 0;
      box-shadow: inset 1px 1px 4px rgba(0,0,0,.3);
      top: 4px;
      left: 4px;
  }

  .mo #toolstyles .objLabel.level1, .mo #tooltheme .objLabel.level1 {
    padding-left: 60px;
  }

  .mo .propInput input[type=text], 
  .mo .propInput input[type=number], 
  .mo .propInput input[type=url],
  .mo .propInput select,
  .mo .propInput .mo-select select,
  .mo .propInput .data-select .selectize-control .selectize-input,
  .mo .propInput .ui-spinner .ui-spinner-input {
    border-width: 0 0 2px 0;
    background-color: transparent;
    &:hover, &:focus, &.focus {
      border-color: @link-color;
    }
  }

  .mo .propInput .data-color .color-text {
    float: none;
  }
  .mo .propInput .data-color input[type=text] {
    margin-left: 10px;
    &:hover, &:focus {
      margin-left: 10px;
    }
  }

  .mo .propInput .evo-pointer {
    border-radius: 50%;
    width: 30px;
    border: 0;
    box-shadow: 1px 1px 3px @shadow-color;
    &:before {
      content: none;
      display: none;
    }
  }

  // evo color specific changes for material-like look 
  .mo .evo-pop {
    min-width: 250px;

    &:before {
      display: block;
      content: "";
      background-color: rgba(158, 158, 158, 0.19);
      position: absolute;
      left: 0;
      right: 0;
      height: 43px;
      bottom: 0;
    }    

    th.ui-widget-content {
      text-align: center;
      font-weight: normal;
    }

    .evo-more {
      text-align: right;
      padding: 7px 5px;
      a {
        color: @link-color;
        text-transform: uppercase;
        font-weight: bold;
      }
    }

    .evo-color {
      padding: 6px 3px 2px 4px;
    }

  }

  // file manager browser button + buttonsets
  .mo .propInput .ui-buttonset,
  .mo .propInput .ui-textbutton .ui-textbutton-button {
    border-radius: @button-border-radius;
    box-shadow: 1px 1px 3px @shadow-color;
  }

}

.wintitle() {
  color: @button-text-color;
  .ui-icon {
    color: @button-text-color;
  }
} 

// slider

.slider-thumb() {
  border-radius: 50%;
  box-shadow: 1px 1px 3px @shadow-color;
  width: @slider-thumb-height;
}

.slider-track() {
  border: 0;
  background-color: lighten(@text-color, 30%);
  border-radius: 4px;
  margin: 2px 0;
}

.mo {
  input[type=range].number-slider {
    &::-ms-thumb {
      margin-right: 3px; // otherwise Edge crops overflow shadow
    }
  }
}
